<div id="diff-options"></div>
<div class="header">
<p>
Next: [[cvs: diff examples#diff examples|diff examples]], Up: [[cvs: diff--Show differences between revisions#diff&mdash;Show differences between revisions|diff]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>

----

<div id="diff-options-1"></div>
==== diff options ====

These standard options are supported by <code>diff</code>
(see [[cvs: Common command options#Common command options|Common options]], for a complete description of
them):

;<code>-D <var>date</var></code>
: Use the most recent revision no later than <var>date</var>. See &lsquo;<code>-r</code>&rsquo; for how this affects the comparison.

;<code>-k <var>kflag</var></code>
: Process keywords according to <var>kflag</var>.  See [[cvs: Keyword substitution#Keyword substitution|Keyword substitution]].

;<code>-l</code>
: Local; run only in current working directory.

;<code>-R</code>
: Examine directories recursively.  This option is on by default.

;<code>-r <var>tag</var></code>
: Compare with revision <var>tag</var>.  Zero, one or two &lsquo;<code>-r</code>&rsquo; options can be present.  With no &lsquo;<code>-r</code>&rsquo; option, the working file will be compared with the revision it was based on.  With one &lsquo;<code>-r</code>&rsquo;, that revision will be compared to your current working file. With two &lsquo;<code>-r</code>&rsquo; options those two revisions will be compared (and your working file will not affect the outcome in any way).

: One or both &lsquo;<code>-r</code>&rsquo; options can be replaced by a &lsquo;<code>-D <var>date</var></code>&rsquo; option, described above.

The following options specify the format of the
output.  They have the same meaning as in GNU diff.
Most options have two equivalent names, one of which is a single letter
preceded by &lsquo;<code>-</code>&rsquo;, and the other of which is a long name preceded by
&lsquo;<code>--</code>&rsquo;.

;&lsquo;<code>-<var>lines</var></code>&rsquo;
: Show <var>lines</var> (an integer) lines of context.  This option does not specify an output format by itself; it has no effect unless it is combined with &lsquo;<code>-c</code>&rsquo; or &lsquo;<code>-u</code>&rsquo;.  This option is obsolete.  For proper operation, <code>patch</code> typically needs at least two lines of context.

;&lsquo;<code>-a</code>&rsquo;
: Treat all files as text and compare them line-by-line, even if they do not seem to be text.

;&lsquo;<code>-b</code>&rsquo;
: Ignore trailing white space and consider all other sequences of one or more white space characters to be equivalent.

;&lsquo;<code>-B</code>&rsquo;
: Ignore changes that just insert or delete blank lines.

;&lsquo;<code>--binary</code>&rsquo;
: Read and write data in binary mode.

;&lsquo;<code>--brief</code>&rsquo;
: Report only whether the files differ, not the details of the differences.

;&lsquo;<code>-c</code>&rsquo;
: Use the context output format.

;&lsquo;<code>-C <var>lines</var></code>&rsquo;
;&lsquo;<code>--context<span class="roman" style="font-family:serif; font-weight:normal"><nowiki>[</nowiki></span>=<var>lines</var><span class="roman" style="font-family:serif; font-weight:normal"><nowiki>]</nowiki></span></code>&rsquo;
: Use the context output format, showing <var>lines</var> (an integer) lines of context, or three if <var>lines</var> is not given. For proper operation, <code>patch</code> typically needs at least two lines of context.

;&lsquo;<code>--changed-group-format=<var>format</var></code>&rsquo;
: Use <var>format</var> to output a line group containing differing lines from both files in if-then-else format.  See [[cvs: Line group formats#Line group formats|Line group formats]].

;&lsquo;<code>-d</code>&rsquo;
: Change the algorithm to perhaps find a smaller set of changes.  This makes <code>diff</code> slower (sometimes much slower).

;&lsquo;<code>-e</code>&rsquo;
;&lsquo;<code>--ed</code>&rsquo;
: Make output that is a valid <code>ed</code> script.

;&lsquo;<code>--expand-tabs</code>&rsquo;
: Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files.

;&lsquo;<code>-f</code>&rsquo;
: Make output that looks vaguely like an <code>ed</code> script but has changes in the order they appear in the file.

;&lsquo;<code>-F <var>regexp</var></code>&rsquo;
: In context and unified format, for each hunk of differences, show some of the last preceding line that matches <var>regexp</var>.

;&lsquo;<code>--forward-ed</code>&rsquo;
: Make output that looks vaguely like an <code>ed</code> script but has changes in the order they appear in the file.

;&lsquo;<code>-H</code>&rsquo;
: Use heuristics to speed handling of large files that have numerous scattered small changes.

;&lsquo;<code>--horizon-lines=<var>lines</var></code>&rsquo;
: Do not discard the last <var>lines</var> lines of the common prefix and the first <var>lines</var> lines of the common suffix.

;&lsquo;<code>-i</code>&rsquo;
: Ignore changes in case; consider upper- and lower-case letters equivalent.

;&lsquo;<code>-I <var>regexp</var></code>&rsquo;
: Ignore changes that just insert or delete lines that match <var>regexp</var>.

;&lsquo;<code>--ifdef=<var>name</var></code>&rsquo;
: Make merged if-then-else output using <var>name</var>.

;&lsquo;<code>--ignore-all-space</code>&rsquo;
: Ignore white space when comparing lines.

;&lsquo;<code>--ignore-blank-lines</code>&rsquo;
: Ignore changes that just insert or delete blank lines.

;&lsquo;<code>--ignore-case</code>&rsquo;
: Ignore changes in case; consider upper- and lower-case to be the same.

;&lsquo;<code>--ignore-matching-lines=<var>regexp</var></code>&rsquo;
: Ignore changes that just insert or delete lines that match <var>regexp</var>.

;&lsquo;<code>--ignore-space-change</code>&rsquo;
: Ignore trailing white space and consider all other sequences of one or more white space characters to be equivalent.

;&lsquo;<code>--initial-tab</code>&rsquo;
: Output a tab rather than a space before the text of a line in normal or context format.  This causes the alignment of tabs in the line to look normal.

;&lsquo;<code>-L <var>label</var></code>&rsquo;
: Use <var>label</var> instead of the file name in the context format and unified format headers.

;&lsquo;<code>--label=<var>label</var></code>&rsquo;
: Use <var>label</var> instead of the file name in the context format and unified format headers.

;&lsquo;<code>--left-column</code>&rsquo;
: Print only the left column of two common lines in side by side format.

;&lsquo;<code>--line-format=<var>format</var></code>&rsquo;
: Use <var>format</var> to output all input lines in if-then-else format. See [[cvs: Line formats#Line formats|Line formats]].

;&lsquo;<code>--minimal</code>&rsquo;
: Change the algorithm to perhaps find a smaller set of changes.  This makes <code>diff</code> slower (sometimes much slower).

;&lsquo;<code>-n</code>&rsquo;
: Output RCS-format diffs; like &lsquo;<code>-f</code>&rsquo; except that each command specifies the number of lines affected.

;&lsquo;<code>-N</code>&rsquo;
;&lsquo;<code>--new-file</code>&rsquo;
: In directory comparison, if a file is found in only one directory, treat it as present but empty in the other directory.

;&lsquo;<code>--new-group-format=<var>format</var></code>&rsquo;
: Use <var>format</var> to output a group of lines taken from just the second file in if-then-else format.  See [[cvs: Line group formats#Line group formats|Line group formats]].

;&lsquo;<code>--new-line-format=<var>format</var></code>&rsquo;
: Use <var>format</var> to output a line taken from just the second file in if-then-else format.  See [[cvs: Line formats#Line formats|Line formats]].

;&lsquo;<code>--old-group-format=<var>format</var></code>&rsquo;
: Use <var>format</var> to output a group of lines taken from just the first file in if-then-else format.  See [[cvs: Line group formats#Line group formats|Line group formats]].

;&lsquo;<code>--old-line-format=<var>format</var></code>&rsquo;
: Use <var>format</var> to output a line taken from just the first file in if-then-else format.  See [[cvs: Line formats#Line formats|Line formats]].

;&lsquo;<code>-p</code>&rsquo;
: Show which C function each change is in.

;&lsquo;<code>--rcs</code>&rsquo;
: Output RCS-format diffs; like &lsquo;<code>-f</code>&rsquo; except that each command specifies the number of lines affected.

;&lsquo;<code>--report-identical-files</code>&rsquo;
;&lsquo;<code>-s</code>&rsquo;
: Report when two files are the same.

;&lsquo;<code>--show-c-function</code>&rsquo;
: Show which C function each change is in.

;&lsquo;<code>--show-function-line=<var>regexp</var></code>&rsquo;
: In context and unified format, for each hunk of differences, show some of the last preceding line that matches <var>regexp</var>.

;&lsquo;<code>--side-by-side</code>&rsquo;
: Use the side by side output format.

;&lsquo;<code>--speed-large-files</code>&rsquo;
: Use heuristics to speed handling of large files that have numerous scattered small changes.

;&lsquo;<code>--suppress-common-lines</code>&rsquo;
: Do not print common lines in side by side format.

;&lsquo;<code>-t</code>&rsquo;
: Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files.

;&lsquo;<code>-T</code>&rsquo;
: Output a tab rather than a space before the text of a line in normal or context format.  This causes the alignment of tabs in the line to look normal.

;&lsquo;<code>--text</code>&rsquo;
: Treat all files as text and compare them line-by-line, even if they do not appear to be text.

;&lsquo;<code>-u</code>&rsquo;
: Use the unified output format.

;&lsquo;<code>--unchanged-group-format=<var>format</var></code>&rsquo;
: Use <var>format</var> to output a group of common lines taken from both files in if-then-else format.  See [[cvs: Line group formats#Line group formats|Line group formats]].

;&lsquo;<code>--unchanged-line-format=<var>format</var></code>&rsquo;
: Use <var>format</var> to output a line common to both files in if-then-else format.  See [[cvs: Line formats#Line formats|Line formats]].

;&lsquo;<code>-U <var>lines</var></code>&rsquo;
;&lsquo;<code>--unified<span class="roman" style="font-family:serif; font-weight:normal"><nowiki>[</nowiki></span>=<var>lines</var><span class="roman" style="font-family:serif; font-weight:normal"><nowiki>]</nowiki></span></code>&rsquo;
: Use the unified output format, showing <var>lines</var> (an integer) lines of context, or three if <var>lines</var> is not given. For proper operation, <code>patch</code> typically needs at least two lines of context.

;&lsquo;<code>-w</code>&rsquo;
: Ignore white space when comparing lines.

;&lsquo;<code>-W <var>columns</var></code>&rsquo;
;&lsquo;<code>--width=<var>columns</var></code>&rsquo;
: Use an output width of <var>columns</var> in side by side format.

;&lsquo;<code>-y</code>&rsquo;
: Use the side by side output format.

 [[cvs: Line group formats#Line group formats|&bull; Line group formats]]::          Line group formats
 [[cvs: Line formats#Line formats|&bull; Line formats]]::                Line formats


----

<div class="header">
<p>
Next: [[cvs: diff examples#diff examples|diff examples]], Up: [[cvs: diff--Show differences between revisions#diff&mdash;Show differences between revisions|diff]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
This document was generated on <i>a sunny day</i> using [http://www.nongnu.org/texi2html/ <i>texi2html</i>].
